using UnityEngine;
using System.Collections;

public class csGUIStyleTools : MonoBehaviour 
{
//For manual setting style using
#region InputData
	public GUIStyle 	Style;
	public GameObject	CopyStyleFrom = null;		//If you want to copy style from other game object, set the target into this pararmeter.
#endregion
	
#region SystemFunc
	public void Start()
	{
	//Get Style from other object
		if(CopyStyleFrom)
		{
		//Get the style
			csGUIStyleTools StyleTools = this.CopyStyleFrom.GetComponent<csGUIStyleTools>();
			if(!StyleTools)
			{
				Debug.LogError("Fail to get GUIStyle from " + this.CopyStyleFrom.name + ".");
			}else{
				this.Style = StyleTools.Style;
			}
		}	//End of if(CopyStyleFrom)
	}
#endregion	
	
//For setting default/Template style using.	But the GUI-type can not be set default value, so the following data is not useful.
/*	
#region Definition
//You can set the default style in this region.	
#endregion
	
	
#region InputData

	public string 			StyleName;		//The text string that can be used to refer to this specific Style.
	public GUIStyleState	NormalState;	//Background image & Text Color of the Control in default state.
	public GUIStyleState	HoverState;		//Background image & Text Color when the mouse is positioned over the Control.
	public GUIStyleState	ActiveState;	//Background image & Text Color when the mouse is actively clicking the Control.
	public GUIStyleState	FocusedState;	//Background image & Text Color when the Control has keyboard focus.
	public GUIStyleState	OnNormalState;	//Background image & Text Color of the Control in enabled state.
	public GUIStyleState	OnHoverState;	//Background image & Text Color when the mouse is positioned over the enabled Control.
	public GUIStyleState	OnActiveState;	//Properties when the mouse is actively clicking the enabled Control.
	public GUIStyleState	OnFocusedState;	//Background image & Text Color when the enabled Control has keyboard focus.
	public RectOffset		Border;			//Number of pixels on each side of the Background image that are not affected by the scale of the Control' shape.
	public RectOffset		Padding;		//Space in pixels from each edge of the Control to the start of its contents.
	public RectOffset		Margin;			//The margins between elements rendered in this style and any other GUI Controls.
	public RectOffset		Overflow;		//Extra space to be added to the background image.		
	public Font				FontType;		//The Font used for all text in this style
	public ImagePosition	Image_Position;	//The way the background image and text are combined.
	public TextAnchor		Alignment;		//Standard text alignment options.
	public bool				WordWrap;		//If enabled, text that reaches the boundaries of the Control will wrap around to the next line.
	public TextClipping		Text_Clipping;	//If Word Wrap is enabled, choose how to handle text that exceeds the boundaries of the Control.
											//	Overflow - Any text that exceeds the Control boundaries will continue beyond the boundaries.
											//	Clip	 - Any text that exceeds the Control boundaries will be hidden.
	public Vector2			ContentOffset;	//Number of pixels along X and Y axes that the Content will be displaced in addition to all other properties.
											//	X - Left/Right Offset.
											//	Y -	Up/Down Offset.
	public float			FixedWidth;		//Number of pixels for the width of the Control, which will override any provided Rect() value.
	public float			FixedHeight;	//Number of pixels for the height of the Control, which will override any provided Rect() value.
	public bool				StretchWidth;	//If enabled, Controls using this style can be stretched horizontally for a better layout.
	public bool				StretchHeight;	//If enabled, Controls using this style can be stretched vertically for a better layout.	
#endregion
	
#region DataMember	
	protected GUIStyle mInstance = null;	//GUIStyle Instance
#endregion
	
#region MemberFunc
	protected void UpdateData()
	{		
		this.mInstance.name 		= this.StyleName;	
		this.mInstance.normal 		= this.NormalState;	
		this.mInstance.hover		= this.HoverState;		
		this.mInstance.active		= this.ActiveState;	
		this.mInstance.focused		= this.FocusedState;	
		this.mInstance.onNormal		= this.OnNormalState;	
		this.mInstance.onHover		= this.OnHoverState;		
		this.mInstance.onActive		= this.OnActiveState;	
		this.mInstance.onFocused	= this.OnFocusedState;	
		this.mInstance.border		= this.Border;	
		this.mInstance.padding		= this.Padding;			
		this.mInstance.margin		= this.Margin;	
		this.mInstance.overflow		= this.Overflow;	
		this.mInstance.font			= this.FontType;	
		this.mInstance.imagePosition= this.Image_Position;	
		this.mInstance.alignment	= this.Alignment;
		this.mInstance.wordWrap		= this.WordWrap;	
		this.mInstance.clipping		= this.Text_Clipping;	
		this.mInstance.contentOffset= this.ContentOffset;	
		this.mInstance.fixedWidth	= this.FixedWidth;	
		this.mInstance.fixedHeight	= this.FixedHeight;
		this.mInstance.stretchWidth	= this.StretchWidth;
		this.mInstance.stretchHeight= this.StretchHeight;		
	}
#endregion
	
#region SystemFunc	
	// Use this for initialization
	void Start () 
	{
	//Create Instance
		this.mInstance = new GUIStyle();
		
	//Set Value
		this.UpdateData();			
	}
#endregion
	
#region Properties
//------------------ Properties Set ----------------------------	
//The text string that can be used to refer to this specific Style.	
	public void SetStyleName(string name) {
		this.StyleName 		= name;
		this.mInstance.name = name;
	}
	
//Background image & Text Color of the Control in default state.	
	public void SetNormalState(GUIStyleState state) {
		this.NormalState 		= state;	
		this.mInstance.normal 	= state;
	}
	
//Background image & Text Color when the mouse is positioned over the Control.	
	public void SetHoverState(GUIStyleState	state) {
		this.HoverState 		= state;		
		this.mInstance.hover	= state;
	}
	
//Background image & Text Color when the mouse is actively clicking the Control.	
	public void SetActiveState(GUIStyleState state) {
		this.ActiveState		= state;	
		this.mInstance.active	= state;
	}
	
//Background image & Text Color when the Control has keyboard focus.	
	public void SetFocusedState(GUIStyleState state) {
		this.FocusedState		= state;	
		this.mInstance.focused	= state;
	}
	
//Background image & Text Color of the Control in enabled state.	
	public void SetOnNormalState(GUIStyleState state) {
		this.OnNormalState		= state;	
		this.mInstance.onNormal	= state;
	}
	
//Background image & Text Color when the mouse is positioned over the enabled Control.	
	public void SetOnHoverState(GUIStyleState state) {
		this.OnHoverState		= state;
		this.mInstance.onHover	= state;	
	}
	
//Properties when the mouse is actively clicking the enabled Control.	
	public void SetOnActiveState(GUIStyleState	state) {
		this.OnActiveState		= state;	
		this.mInstance.onActive	= state;
	}
	
//Background image & Text Color when the enabled Control has keyboard focus.	
	public void SetOnFocusedState(GUIStyleState	state) {
		this.OnFocusedState 		= state;	
		this.mInstance.onFocused	= state;
	}
	
//Number of pixels on each side of the Background image that are not affected by the scale of the Control' shape.
	public void SetBorder(RectOffset border) {
		this.Border 			= border;			
		this.mInstance.border	= border;
	}
	
//Space in pixels from each edge of the Control to the start of its contents.	
	public void SetPadding(RectOffset padding) {
		this.Padding			= padding;		
		this.mInstance.padding	= padding;
	}
	
//The margins between elements rendered in this style and any other GUI Controls.	
	public void SetMargin(RectOffset margin) {
		this.Margin				= margin;			
		this.mInstance.margin	= margin;
	}
	
//Extra space to be added to the background image.			
	public void SetOverFlow(RectOffset overflow) {
		this.Overflow			= overflow;		
		this.mInstance.overflow	= overflow;
	}
	
//The Font used for all text in this style	
	public void SetFont(Font font) {
		this.FontType		= font;		
		this.mInstance.font	= font;
	}
	
//The way the background image and text are combined.	
	public void SetImagePosition(ImagePosition pos) {
		this.Image_Position				= pos;	
		this.mInstance.imagePosition	= pos;
	}
	
//Standard text alignment options.	
	public void SetAlignment(TextAnchor	align) {
		this.Alignment				= align;		
		this.mInstance.alignment	= align;
	}
	
//If enabled, text that reaches the boundaries of the Control will wrap around to the next line.	
	public void SetWordWrap(bool warp) {
		this.WordWrap			= warp;		
		this.mInstance.wordWrap	= warp;
	}
	
//If Word Wrap is enabled, choose how to handle text that exceeds the boundaries of the Control.
//	Overflow - Any text that exceeds the Control boundaries will continue beyond the boundaries.
//	Clip	 - Any text that exceeds the Control boundaries will be hidden.	
	public void SetTextClipping(TextClipping clipping) {
		this.Text_Clipping		= clipping;	
		this.mInstance.clipping	= clipping;
	}
	
	
//Number of pixels along X and Y axes that the Content will be displaced in addition to all other properties.
//	X - Left/Right Offset.
//	Y -	Up/Down Offset.	
	public void SetContentOffset(Vector2 offset) {
		this.ContentOffset				= offset;	
		this.mInstance.contentOffset	= offset;
	}
	
//Number of pixels for the width of the Control, which will override any provided Rect() value.	
	public void SetFixedWidth(float width) {
		this.FixedWidth				= width;		
		this.mInstance.fixedWidth	= width;
	}
	
//Number of pixels for the height of the Control, which will override any provided Rect() value.
	public void SetFixedHeight(float height) {
		this.FixedHeight			= height;	
		this.mInstance.fixedHeight	= height;
	}
	
//If enabled, Controls using this style can be stretched horizontally for a better layout.	
	public void SetStrechWidth(bool IsStrechWidth) {
		this.StretchWidth			= IsStrechWidth;	
		this.mInstance.stretchWidth	= IsStrechWidth;
	}
	
//If enabled, Controls using this style can be stretched vertically for a better layout.					
	public void SetStrechHeight(bool IsStrechHeight) {
		this.StretchHeight				= IsStrechHeight;	
		this.mInstance.stretchHeight	= IsStrechHeight;
	}
	
//------------------ Properties Get ----------------------------	
	public GUIStyle GetStyle() { return this.mInstance; }
#endregion
*/	
}
